package com.treasure.mall.zbqmallapi.vo.community;

import com.treasure.mall.biz.entity.community.CommunityCommentPO;
import com.treasure.mall.biz.vo.BaseVO;
import com.treasure.mall.zbq.common.Jsr310Utils;
import com.treasure.mall.zbqmallapi.vo.user.UserBaseVO;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 *
 * <p>
 * +---------------------------------------------------------
 * * @package: com.treasure.mall.zbqmallapi.vo.community
 * * @author: guomw (guomwchen@foxmail.com)
 * * @date: 2020/7/28 10:04 上午
 * * @since: V1.0.0
 * +---------------------------------------------------------
 * 注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的
 *
 */
@Data
@NoArgsConstructor
public class CommentsVO implements BaseVO {
    private static final long serialVersionUID = 7585120874054946369L;
    /**
     * 评论ID
     */
    private Long id;
    /**
     * 评论文章ID
     */
    private Long articleId;
    /**
     * 当前评论点赞总数量
     */
    private long likeCount;
    /**
     * 回复数量
     */
    private long replyCount;
    /**
     * 评论父ID
     */
    private Long parentId;
    /**
     * 用户基本信息
     */
    private UserBaseVO replyUser;

    /**
     * 回复目标用户昵称
     */
    private String targetUserName;
    /**
     * 回复目标用户ID
     */
    private Long targetUserId;
    /**
     * 当前是否是作者评论
     */
    private boolean author;
    /**
     * 评论内容
     */
    private String commentsText;
    /**
     * 评论时间
     */
    private String createTime;
    /**
     * 是否点赞
     */
    private boolean liked;

    public CommentsVO(CommunityCommentPO po) {
        this.id = po.getId();
        this.articleId = po.getArticleId();
        this.likeCount = po.getLikeCount();
        this.replyCount = po.getReplyCount();
        this.parentId = po.getParentId();
        this.replyUser = new UserBaseVO(po.getUserPO());
        this.targetUserId = po.getTargetUserId();
        this.targetUserName = po.getTargetUserName();
        this.author = po.isAuthor();
        this.commentsText = po.getCommentsText();
        this.createTime = Jsr310Utils.DateTime.asString(po.getCreateTime());
    }
}
